IF EXISTS (SELECT *
           FROM INFORMATION_SCHEMA.ROUTINES
           WHERE ROUTINE_NAME='fXXXXX'
           AND ROUTINE_SCHEMA='dbo'
           AND ROUTINE_TYPE='FUNCTION'
          )
          DROP FUNCTION dbo.fXXXXX
GO

CREATE FUNCTION [dbo].[fXXXXX] (
    
)
RETURNS NVARCHAR(255)
AS
BEGIN
/*@@*_____________________________________________________________________

  

_____________________________________________________________________*@@*/

/*______________________ CONSTANT DECLARATIONS _________________________*/


/*______________________ VARIABLE DECLARATIONS _________________________*/

  DECLARE
    @intErrNo       INT,
    @strErrMsg      NVARCHAR(400),
    @strReturn      NVARCHAR(255)

/*_______________________________ INIT _________________________________*/


/*________________________ VALIDATE PARAMETERS _________________________*/


/*_______________________________ MAIN _________________________________*/


  SET @strReturn =  ...

lblExit:

  RETURN @strReturn

END

